package com.xin.data.simbapesa.obj;

import android.text.TextUtils;


import com.xin.data.simbapesa.utils.DateUtils;

import java.util.Date;

public class SimbaCouponsItem {

    private boolean isExpire = true;
    private boolean isBirth;
    private int couponId;

    private String couponGhs;

    private String newCouponGhs;

    private boolean isBox;

    private String startDate;

    private String expireDate;


    private boolean isReceived = true;

    private int expireDays;

    private int vip;

    private String expirationTime;

    public String getExpirationTime() {
        return expirationTime;
    }

    public void setExpirationTime(String expirationTime) {
        this.expirationTime = expirationTime;
    }

    public boolean isExpire() {
        return isExpire;
    }

    public void setExpire(boolean expire) {
        isExpire = expire;
    }

    public boolean isBirth() {
        return isBirth;
    }

    public void setBirth(boolean birth) {
        isBirth = birth;
    }

    public int getCouponId() {
        return couponId;
    }

    public void setCouponId(int couponId) {
        this.couponId = couponId;
    }

    public String getCouponGhs() {
        return couponGhs;
    }

    public void setCouponGhs(String couponGhs) {
        this.couponGhs = couponGhs;
    }

    public boolean isBox() {
        return isBox;
    }

    public void setBox(boolean box) {
        isBox = box;
    }

    public String getStartDate() {
        return startDate;
    }

    public void setStartDate(String startDate) {
        this.startDate = startDate;
    }

    public String getExpireDate() {
        return expireDate;
    }

    public void setExpireDate(String expireDate) {
        this.expireDate = expireDate;
    }

    public boolean isReceived() {
        return isReceived;
    }

    public void setReceived(boolean received) {
        isReceived = received;
    }

    public int getExpireDays() {
        return expireDays;
    }

    public void setExpireDays(int expireDays) {
        this.expireDays = expireDays;
    }

    public int getVip() {
        return vip;
    }

    public void setVip(int vip) {
        this.vip = vip;
    }

    public String getNewCouponGhs() {
        return newCouponGhs;
    }

    public void setNewCouponGhs(String newCouponGhs) {
        this.newCouponGhs = newCouponGhs;
    }

    public void initData() {


        if (!TextUtils.isEmpty(startDate)) {
            startDate = DateUtils.getFormatTime(DateUtils.getDateMM(startDate));
        }

        if (!TextUtils.isEmpty(expirationTime)) {
            expireDate = DateUtils.getFormatTime(new Date(Long.parseLong(expirationTime) * 1000));
        }

        if (!TextUtils.isEmpty(expireDate)) {
            Date date1 = DateUtils.getDate(expireDate);
            Date date2 = new Date();
            expireDays = DateUtils.getDaysBetweenDates(date2, date1);
        }

        if (!TextUtils.isEmpty(expireDate)) {
            Date date1 = DateUtils.getDate(expireDate);
            if(date1!=null) {
                Date date2 = new Date();
                isReceived = date2.getTime() <= date1.getTime();
            }
        } else {
            isReceived = false;
        }

    }

}
